/*
 * 角色权限
 */
import { getRequest, postRequest } from '/@/lib/axios';

export const roleApi = {
  /**
   * @description: 获取所有角色
   * @param {*}
   * @return {*}
   */
  queryAll: () => {
    return getRequest('/sys/role/queryAll');
  },
  /**
   * @description:更新角色
   * @param {*}
   * @return {*}
   */
  updateRole: (data) => {
    return postRequest('/sys/role/save', data);
  },
  /**
   * @description: 删除角色
   * @param {number} roleId
   * @return {*}
   */
  deleteRole: (roleId) => {
    return getRequest(`/sys/role/delete?roleId=${roleId}`);
  },
  /**
   * @description: 获取关联资源
   * @param {number} roleId
   * @return {*}
   */
  findResourceIdByRoleId: (roleId) => {
    return getRequest(`/sys/role/findResourceIdByRoleId?roleId=${roleId}`);
  },
  /**
   * @description: 保存资源角色关联
   * @param {AuthUpdateDTO} data
   * @return {*}
   */
  saveMenuRole: (data) => {
    return postRequest('/sys/role/saveMenuRole', data);
  },
  /**
   * @description: 获取角色成员-员工列表
   * @param {*}
   * @return {*}
   */
  queryRoleEmployee: (params) => {
    return postRequest('/sys/role/roleRelateUserPage', params);
  },
  /**
   * @description: 角色成员列表中批量添加/取消员工
   * @param  data
   * @return {*}
   */
  relateOrCancelUserAuth: (data) => {
    return postRequest('/sys/role/relateOrCancelUserAuth', data);
  },
};
